From 6c484ca4f36f4ab8ce5b330e93d954609717bca6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Thu, 4 May 2017 09:36:49 +0200 Subject: [PATCH] button: Remove gadget usage Can't remove it entirely yet, since GtkCheckButton still uses it --- gtk/gtkbutton.c | 86 ++++++++----------------------------------------- 1 file changed, 13 insertions(+), 73 deletions(-) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index e9ac07db5f..b08b0f5a1d 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -151,19 +151,6 @@ static void gtk_button_measure_ (GtkWidget *widget, int *natural, int *minimum_baseline, int *natural_baseline); -static void gtk_button_measure (GtkCssGadget *gadget, - GtkOrientation orientation, - int for_size, - int *minimum_size, - int *natural_size, - int *minimum_baseline, - int *natural_baseline, - gpointer data); -static void gtk_button_allocate (GtkCssGadget *gadget, - const GtkAllocation *allocation, - int baseline, - GtkAllocation *out_clip, - gpointer data); static void gtk_button_set_child_type (GtkButton *button, guint child_type); static GParamSpec *props[LAST_PROP] = { NULL, }; @@ -458,8 +445,8 @@ gtk_button_init (GtkButton *button) priv->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (button)), GTK_WIDGET (button), - gtk_button_measure, - gtk_button_allocate, + NULL, + NULL, NULL, NULL, NULL); @@ -773,40 +760,15 @@ gtk_button_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkButton *button = GTK_BUTTON (widget); - GtkButtonPrivate *priv = button->priv; - GtkAllocation clip; - - gtk_widget_set_allocation (widget, allocation); - gtk_css_gadget_allocate (priv->gadget, - allocation, - gtk_widget_get_allocated_baseline (widget), - &clip); - - gtk_widget_set_clip (widget, &clip); -} - -static void -gtk_button_allocate (GtkCssGadget *gadget, - const GtkAllocation *allocation, - int baseline, - GtkAllocation *out_clip, - gpointer unused) -{ - GtkWidget *widget; + GtkAllocation clip = *allocation; GtkWidget *child; - widget = gtk_css_gadget_get_owner (gadget); - - *out_clip = *allocation; - child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) { - GtkAllocation clip; - - gtk_widget_size_allocate_with_baseline (child, (GtkAllocation *)allocation, baseline); + gtk_widget_size_allocate_with_baseline (child, allocation, + gtk_widget_get_allocated_baseline (widget)); gtk_widget_get_clip (child, &clip); - gdk_rectangle_union (&clip, out_clip, out_clip); } } @@ -959,22 +921,16 @@ gtk_button_finish_activate (GtkButton *button, gtk_button_clicked (button); } - static void -gtk_button_measure (GtkCssGadget *gadget, - GtkOrientation orientation, - int for_size, - int *minimum, - int *natural, - int *minimum_baseline, - int *natural_baseline, - gpointer data) +gtk_button_measure_ (GtkWidget *widget, + GtkOrientation orientation, + int for_size, + int *minimum, + int *natural, + int *minimum_baseline, + int *natural_baseline) { - GtkWidget *widget; - GtkWidget *child; - - widget = gtk_css_gadget_get_owner (gadget); - child = gtk_bin_get_child (GTK_BIN (widget)); + GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) { @@ -995,22 +951,6 @@ gtk_button_measure (GtkCssGadget *gadget, } } -static void -gtk_button_measure_ (GtkWidget *widget, - GtkOrientation orientation, - int for_size, - int *minimum, - int *natural, - int *minimum_baseline, - int *natural_baseline) -{ - gtk_css_gadget_get_preferred_size (GTK_BUTTON (widget)->priv->gadget, - orientation, - for_size, - minimum, natural, - minimum_baseline, natural_baseline); -} - /** * gtk_button_set_label: * @button: a #GtkButton -- 2.30.2